<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="__ROOT__/public/css/style.css">
    <link rel="stylesheet" href="__ROOT__/public/css/ui.css">
    <script src="__ROOT__/public/js/ui.js"></script>
    <script src="__ROOT__/static/plugs/jquery/jquery.min.js"></script>
    <script src="__ROOT__/public/js/common.js"></script>
    <title>团队佣金</title>
    <style>
        nav {
            display: flex;
            ;
            border-bottom: 1px solid #e5e5e5;

        }

        nav>p {
            width: 33%;
            text-align: center;
            height: 2rem;
            line-height: 2rem;
        }

        .active {
            color: #ffc000;
            position: relative;
        }

        .active::after {
            content: "";
            position: absolute;
            width: 60%;
            height: 1px;
            background: #ffc000;
            bottom: 0;
            left: 0;
            right: 0;
            margin: auto;
        }

        li {
            height: 2.5rem;
            border-bottom: 1px solid #e5e5e5;
            line-height: 2.5rem;
        }

        .head {
            width: 2rem;
            height: 2rem;
            overflow: hidden;
            border-radius: 50%;
            margin: auto .3rem auto .3rem;
            background: skyblue;
        }

        img {
            width: 100%;
            height: 100%;
        }

        li p {
            text-align: center;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        li p span{
            color:red;
        }
        .user {
            width: 23%;
            color: red;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        .content ul {
            display: none;
        }
    </style>
</head>

<body>
    <header>
        <div class="back" onclick="window.history.back(-1)"></div>
        <span>团队佣金</span>
    </header>
    <div class="container">
        <nav>
            <p class="active">一代佣金</p>
            <p>二代佣金</p>
            <p>三代佣金</p>
        </nav>
        <div class="content">
            <ul class="onelist" style="display: block;">
                <!-- 一代列表 -->
            </ul>
            <ul class="twolist">
                <!-- 二代列表 -->
            </ul>
            <ul class="threelist">
                <!-- 三代列表 -->
            </ul>
        </div>
    </div>
</body>
<script>
    $(function() {
        getList(1, 1)
    })

    $('nav>p').click(function () {
        var _ind = $(this).index();
        $(this).addClass('active').siblings().removeClass('active');
        $('.content>ul').eq(_ind).show().siblings().hide();
        getList(_ind + 1, 1)
    })

    function getList(lv, page) {
        $.ajax({
            url: urlPost("my/get_team_reward"),
            type: "POST",
            dataType: "JSON",
            data: { lv:lv, page:page },
            success: function(res) {
                console.log(res)
                var num = lv == 1 ? 'one' : (lv == 2 ? 'two' : 'three');
                $(`.${num}list`).html('');
                if (res.code == 0) {
                    $(`.${num}list`).append(`
                        <li>
                            <p>今日佣金：<span>${res.data}</span></p>
                        </li>
                    `)
                }else{
                    $(`.${num}list`).append(`
                        <li>
                            <p>今日佣金：<span>0</span></p>
                        </li>
                    `)
                }
            },
            error: function(err){
                console.log(err)
            }
        })
    }
</script>

</html>